﻿using HomagChina.CCT.DataTypeModel;
using HomagChina.CCT.ViewModels;
using HomagGroup.Base.UI;
using HomagGroup.Base.UI.Themes.Resources;
using Proxy;
using System.Collections.ObjectModel;
using static HomagChina.CCT.ProcessResourceInternal;
using static HomagChina.CCT.Utility;

namespace HomagChina.CCT.Router
{
    public class HomeRoute : NotifyPropertyChangedBase
    {
        public RouterItemDataModel HomeRouteModel { get; set; }
        private CommonHandle Handle_Common;
        private SearchInfoHandle Handle_Search;

        public HomeRoute()
        {
            Handle_Common = new CommonHandle();
            Handle_Search = new SearchInfoHandle();
            var model = new HomeViewModel();
            HomeRouteModel = new RouterItemDataModel()
            {
                ID = "Home",
                viewLabel = GetLocalText("Home"),
                viewName = "Home",
                keepalive = true,
                viewModelName = "HomeViewModel",
                ViewModel = model,
                userControl = GetUserControlInstance("Home"),
                Image = GetIconBrush(Icon.Home),
                functionKeyBarItems = new ObservableCollection<FunctionKeyBarItemDataModel>
                {
                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocalText("Exit"),
                    //    Position = 12,
                    //    Icon = GetIconBrush(Icon.Close, ImageDecoration.Circle),
                    //    Command = new RelayCommand(() => { Application.Current.Shutdown(); })
                    //},

                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocaText("Error message"),
                    //    Position = 11,
                    //    Icon = GetResourceBrush("ErrorMessages"),
                    //    Command= new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("ErrorMessage"); })
                    //},

                    //new FunctionKeyBarItemDataModel() {
                    //    Header = GetLocaText("PlusEnginOrder"),
                    //    Position = 9,
                    //    Icon = GetIconBrush(Icon.Menu , ImageDecoration.Box , OverlayIcon.Pencil)
                    //},

                    //new FunctionKeyBarItemDataModel() {
                    //    Header =  GetLocaText("PlusEnginOrder"),
                    //    Position = 8,
                    //    Icon = GetIconBrush(Icon.Menu , ImageDecoration.Box , OverlayIcon.Pencil),
                    //    Command= new RelayCommand(model.AddHomeAddEngineeringOrder),
                    //    IsEnabled=false
                    //},
                    new FunctionKeyBarItemDataModel() {
                        Header = GetLocalText("CopyInfo"),
                        Position = 7,
                        Icon = GetIconBrush(Icon.Copy),
                        Command=new RelayCommand(model.HandleOpenMprFile)
                    },
                    new FunctionKeyBarItemDataModel() {
                        Header = GetLocalText("PartsInfo"),
                        Position = 6,
                        Icon = GetIconBrush(Icon.Selection),
                        Command = new RelayCommand(()=>{ NavigateServices.Instance.NavigateTo("PartsInfo"); }),
                        CommandParameter = "8"
                    },
                    new FunctionKeyBarItemDataModel()
                    {
                        Header = GetLocalText("Settings"),
                        Position = 2,
                        Icon = GetResourceBrush("Settings"),
                        Command = new RelayCommand(() => { NavigateServices.Instance.NavigateTo("Settings"); })
                    },
                    new FunctionKeyBarItemDataModel()
                    {
                        Header = GetLocalText("Info"),
                        Position = 1,
                        Icon = GetIconBrush(Icon.Information, imageDecoration: ImageDecoration.Circle),
                        Command = new RelayCommand(() => { Handle_Common.OpenInformationCommand(Handle_Search.GetSystemInfoMation()); })
                    }
                }
            };
            HomeRouteModel.userControl.DataContext = model;
        }
    }
}